#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <utility>
#include <vector>
using namespace std;
inline long long F_CalcScheme(long long len, long long coincidence)
{
    if (coincidence > 0) {
        return len * (len + 1) / 2 - coincidence * (coincidence + 1) / 2;
    }
    else {
        return len * (len + 1) / 2;
    }
}

int main()
{
    int n, k, a;
    int sum_2 = 0, sum_5 = 0;
    cin >> n >> k;
    vector<pair<int, int>> vec(n, { 0, 0 }); 
    for (int i = 0; i < n; i++) {
        cin >> a;
        while (!(a % 2)) {
            vec[i].first++;
            sum_2++;
            a /= 2;
        }
        while (!(a % 5)) {
            vec[i].second++;
            sum_5++;
            a /= 5;
        }
    }

    sum_2 -= k;
    sum_5 -= k;
    if (sum_2 < 0 || sum_5 < 0) { 
        cout << 0;
        return 0;
    }
    long long res = 0;
    int l = 0, r = 0, pre_r = 0;
    while (r < n) { 
        int temp_2 = sum_2 - vec[r].first, temp_5 = sum_5 - vec[r].second;
        if (temp_2 >= 0 && temp_5 >= 0) { 
            sum_2 = temp_2;
            sum_5 = temp_5;
            r++;
        }
        else {
            if (l != r) { 
                if (pre_r != r) { 
                    res += F_CalcScheme(r - l, pre_r - l);
                    pre_r = r;
                }
                sum_2 += vec[l].first;
                sum_5 += vec[l].second;
                l++;
            }
            else {
                l++;
                r++;
            }
        }
    }
    if (l != r) {
        res += F_CalcScheme(r - l, pre_r - l);
    }
    cout << res;
}